<?php

class Application_Model_Buy extends Application_Model_ModelAbstract
{
    protected $buy_id;
    protected $buy_name;
    protected $buy_type;
    protected $buy_status;
    protected $buy_description;

    const TYPE_OTHER      = 1;
    const TYPE_TECHNOLOGY = 2;
    const TYPE_LIFE       = 3;
    const TYPE_SPORTS     = 4;
    const TYPE_WEAR       = 5;
    const TYPE_GLOBAL     = 6;

    const UP_TOP    = 3;
    const DOWN_TOP  = 2;

    const MAX_PRIORITY  = 9;
    const MIN_PRIORITY  = 1;

    public static $types = array(
        self::TYPE_OTHER      => 'Разное',
        self::TYPE_TECHNOLOGY => 'Техника',
        self::TYPE_LIFE       => 'Быт',
        self::TYPE_SPORTS     => 'Спорт',
        self::TYPE_WEAR       => 'Одежда',
        self::TYPE_GLOBAL     => 'Глобальные',
    );

    public static function getTypes()
    {
        return self::$types;
    }

    public static function getTypeById($id)
    {
        return isset(self::$types[$id]) ? self::$types[$id] : null;
    }

    public function setBuyId($value)
    {
        $this->buy_id = $value;
    }

    public function setBuyName($value)
    {
        $this->buy_name = $value;
    }

    public function setBuyType($value)
    {
        $this->buy_type = $value;
    }

    public function setBuyStatus($value)
    {
        $this->buy_status = $value;
    }

    public function setBuyDescription($value)
    {
        $this->buy_description = $value;
    }

    public function getBuyId()
    {
        return $this->buy_id;
    }

    public function getBuyName()
    {
        return $this->buy_name;
    }

    public function getBuyType()
    {
        return $this->buy_type;
    }

    public function getBuyStatus()
    {
        return $this->buy_status;
    }

    public function getBuyDescription()
    {
        return htmlspecialchars_decode($this->buy_description);
    }
}
